home *** CD-ROM | disk | FTP | other *** search
- package asciiShop;
-
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.FileDialog;
- import java.awt.Frame;
- import java.awt.Insets;
- import java.awt.LayoutManager;
- import java.awt.List;
- import java.awt.Menu;
- import java.awt.MenuBar;
- import java.awt.MenuItem;
- import java.awt.Point;
- import java.awt.TextArea;
- import java.awt.Window;
- import java.awt.event.ActionEvent;
- import java.awt.event.ItemEvent;
- import java.awt.event.TextEvent;
- import java.awt.event.WindowEvent;
- import java.io.BufferedReader;
- import java.io.FileNotFoundException;
- import java.io.FileReader;
- import java.io.FileWriter;
- import java.io.IOException;
- import java.io.PrintWriter;
-
- public class mainFrame extends Frame {
- char[][] artBuffer2;
- int useLength;
- int length1;
- int length2;
- int globalCount = 0;
- PrintWriter writeToFile;
- String bigString;
- // $FF: renamed from: i int
- int field_0;
- // $FF: renamed from: j int
- int field_1;
- // $FF: renamed from: k int
- int field_2;
- int countForOpenFile;
- int countForOpenFileSave;
- FileDialog newFile;
- String pathToFile;
- String file;
- BufferedReader openFile;
- String[] artBuffer;
- String[][] layerBuffer;
- TextArea fileBuffer = new TextArea();
- List layers = new List();
- MenuBar menuBar1 = new MenuBar();
- Menu menuFile = new Menu();
- MenuItem menuFileOpen = new MenuItem();
- MenuItem menuFileWriteOut = new MenuItem();
- MenuItem menuFileQuit = new MenuItem();
- MenuItem menuFileRefreshArt = new MenuItem();
- MenuItem menuFileReplaceCharacters = new MenuItem();
- Menu menuLayers = new Menu();
- MenuItem menuLayersAddLayer = new MenuItem();
- MenuItem menuLayersRemoveLayer = new MenuItem();
- MenuItem menuLayersRedrawLayers = new MenuItem();
- Menu menumirror = new Menu();
- MenuItem menumirrorSideWays = new MenuItem();
- MenuItem menumirrorFlipVerticle = new MenuItem();
- Menu menuLineTools = new Menu();
- MenuItem menuLineToolsVerticleLine = new MenuItem();
- MenuItem menuLineToolsHorizantalLine = new MenuItem();
- private boolean mShown = false;
-
- public void initComponents() throws Exception {
- this.fileBuffer.setLocation(new Point(60, 70));
- this.fileBuffer.setVisible(true);
- this.fileBuffer.setSize(new Dimension(480, 360));
- this.layers.setLocation(new Point(570, 270));
- this.layers.setVisible(true);
- this.layers.setSize(new Dimension(130, 160));
- this.menuBar1.add(this.menuFile);
- this.menuBar1.add(this.menuLayers);
- this.menuBar1.add(this.menumirror);
- this.menuBar1.add(this.menuLineTools);
- this.menuFile.setLabel("File");
- this.menuFile.add(this.menuFileOpen);
- this.menuFile.add(this.menuFileWriteOut);
- this.menuFile.add(this.menuFileQuit);
- this.menuFile.add(this.menuFileRefreshArt);
- this.menuFile.add(this.menuFileReplaceCharacters);
- this.menuFileOpen.setLabel("Open");
- this.menuFileWriteOut.setLabel("Write Out");
- this.menuFileQuit.setLabel("Quit");
- this.menuFileRefreshArt.setLabel("Refresh Art");
- this.menuFileReplaceCharacters.setLabel("Replace Characters");
- this.menuLayers.setLabel("Layers");
- this.menuLayers.add(this.menuLayersAddLayer);
- this.menuLayers.add(this.menuLayersRemoveLayer);
- this.menuLayers.add(this.menuLayersRedrawLayers);
- this.menuLayersAddLayer.setLabel("Add Layer");
- this.menuLayersRemoveLayer.setLabel("Remove Layer");
- this.menuLayersRedrawLayers.setLabel("Redraw Layers");
- this.menumirror.setLabel("mirror");
- this.menumirror.add(this.menumirrorSideWays);
- this.menumirror.add(this.menumirrorFlipVerticle);
- this.menumirrorSideWays.setLabel("invert");
- this.menumirrorFlipVerticle.setLabel("Flip Characters Verticle");
- this.menuLineTools.setLabel("Line Tools");
- this.menuLineTools.add(this.menuLineToolsVerticleLine);
- this.menuLineTools.add(this.menuLineToolsHorizantalLine);
- this.menuLineToolsVerticleLine.setLabel("Verticle Line");
- this.menuLineToolsHorizantalLine.setLabel("Horizantal Line");
- ((Component)this).setLocation(new Point(5, 40));
- ((Frame)this).setTitle("asciiShop.mainFrame");
- ((Container)this).setLayout((LayoutManager)null);
- ((Frame)this).setMenuBar(this.menuBar1);
- ((Component)this).setSize(new Dimension(736, 520));
- ((Container)this).add(this.fileBuffer);
- ((Container)this).add(this.layers);
- this.fileBuffer.addTextListener(new 1(this));
- this.layers.addItemListener(new 2(this));
- this.menuFileOpen.addActionListener(new 3(this));
- this.menuFileWriteOut.addActionListener(new 4(this));
- this.menuFileRefreshArt.addActionListener(new 5(this));
- this.menuFileReplaceCharacters.addActionListener(new 6(this));
- this.menuLayersAddLayer.addActionListener(new 7(this));
- this.menumirrorSideWays.addActionListener(new 8(this));
- this.menumirrorFlipVerticle.addActionListener(new 9(this));
- this.menuLineToolsVerticleLine.addActionListener(new 10(this));
- ((Window)this).addWindowListener(new 11(this));
- }
-
- public void addNotify() {
- super.addNotify();
- if (!this.mShown) {
- Insets var1 = ((Container)this).getInsets();
- Component[] var2 = ((Container)this).getComponents();
-
- for(int var3 = 0; var3 < var2.length; ++var3) {
- Point var4 = var2[var3].getLocation();
- var4.move(var4.x, var4.y + var1.top);
- var2[var3].setLocation(var4);
- }
-
- this.mShown = true;
- }
- }
-
- void thisWindowClosing(WindowEvent var1) {
- ((Component)this).setVisible(false);
- ((Frame)this).dispose();
- System.exit(0);
- }
-
- public void list1ItemStateChanged(ItemEvent var1) {
- }
-
- public void layersItemStateChanged(ItemEvent var1) {
- }
-
- public void fileBufferTextValueChanged(TextEvent var1) {
- }
-
- public void menuFileOpenActionPerformed(ActionEvent var1) {
- this.bigString = new String("");
- this.countForOpenFile = 0;
- this.newFile = new FileDialog(this, "Open File", 0);
- this.newFile.setVisible(true);
- this.pathToFile = this.newFile.getDirectory();
- this.file = this.newFile.getFile();
- this.artBuffer = new String[200];
-
- try {
- System.out.println(this.pathToFile + this.file);
- this.openFile = new BufferedReader(new FileReader(this.pathToFile + this.file));
- } catch (FileNotFoundException var2) {
- System.out.println("The file could not be found... DAMN MICROSOFT!!!");
- }
-
- try {
- while(!(this.artBuffer[this.countForOpenFile] = this.openFile.readLine()).equals("***end***")) {
- ++this.countForOpenFile;
- }
- } catch (IOException var3) {
- System.out.println("HOW THE HELL DiD YOU GET THIS ERROR!?");
- }
-
- System.out.println("How many lines in the art: " + this.countForOpenFile);
-
- for(this.field_0 = 0; this.field_0 < this.countForOpenFile; ++this.field_0) {
- this.bigString = this.bigString + this.artBuffer[this.field_0] + "\n";
- }
-
- this.fileBuffer.setText(this.bigString);
- this.countForOpenFileSave = this.countForOpenFile;
- }
-
- public void menuFileWriteOutActionPerformed(ActionEvent var1) {
- this.newFile = new FileDialog(this, "Save File", 1);
- this.newFile.setVisible(true);
- this.pathToFile = this.newFile.getDirectory();
- this.file = this.newFile.getFile();
-
- try {
- this.writeToFile = new PrintWriter(new FileWriter(this.pathToFile + this.file), true);
- System.out.println("Wrote to file: " + this.pathToFile + this.file);
- } catch (IOException var2) {
- System.out.println("GODDAMN HOW THE HELL DID YOU MANAGE TO GET THIS ERROR!?");
- }
-
- this.bigString = this.fileBuffer.getText();
- this.writeToFile.println(this.bigString + "\n***end***");
- System.out.println("Wrote out to file: " + this.pathToFile + this.file + "\n" + this.bigString + "***end***");
- }
-
- public void menuLayersAddLayerActionPerformed(ActionEvent var1) {
- String[][] var2 = this.layerBuffer;
- this.layerBuffer = new String[this.globalCount + 1][200];
-
- for(int var3 = 0; var3 < this.globalCount; ++var3) {
- this.layerBuffer[var3] = var2[var3];
- }
-
- this.countForOpenFile = 0;
- this.newFile = new FileDialog(this, "Add Layer", 0);
- this.newFile.setVisible(true);
- this.pathToFile = this.newFile.getDirectory();
- this.file = this.newFile.getFile();
- this.layerBuffer[this.globalCount] = new String[200];
- System.out.println("Trying to apply layer: " + this.pathToFile + this.file);
-
- try {
- this.openFile = new BufferedReader(new FileReader(this.pathToFile + this.file));
- } catch (IOException var4) {
- System.out.println("HOW THE HELL DID YOU GET THIS ERROR!? - 3");
- }
-
- try {
- while(!(this.layerBuffer[this.globalCount][this.countForOpenFile] = this.openFile.readLine()).equals("***end***")) {
- ++this.countForOpenFile;
- }
- } catch (IOException var5) {
- System.out.println("HOW THE HELL DID YOU GET THIS ERROR!? -2");
- }
-
- this.length1 = this.artBuffer[0].length();
- this.length2 = this.layerBuffer[this.globalCount][0].length();
- if (this.length1 < this.length2) {
- this.useLength = this.length2;
- } else {
- this.useLength = this.length1;
- }
-
- this.artBuffer2 = new char[200][200];
-
- for(this.field_0 = 0; this.field_0 < this.countForOpenFileSave; ++this.field_0) {
- for(this.field_2 = 0; this.field_2 < this.useLength; ++this.field_2) {
- this.artBuffer2[this.field_0][this.field_2] = this.artBuffer[this.field_0].charAt(this.field_2);
- }
-
- for(this.field_1 = 0; this.field_1 < this.useLength; ++this.field_1) {
- if (this.layerBuffer[this.field_0][this.field_1].charAt(this.field_1) != ' ') {
- this.artBuffer2[this.field_0][this.field_1] = this.layerBuffer[this.field_0][this.field_1].charAt(this.field_1);
- } else {
- this.artBuffer2[this.field_0][this.field_1] = ' ';
- }
- }
- }
-
- for(this.field_0 = 0; this.field_0 < this.countForOpenFileSave; ++this.field_0) {
- for(this.field_2 = 0; this.field_2 < this.useLength; ++this.field_2) {
- System.out.println(this.artBuffer2[this.field_0][this.field_2]);
- }
- }
-
- for(this.field_0 = 0; this.field_0 < this.countForOpenFileSave; ++this.field_0) {
- System.out.println(this.artBuffer[this.field_0]);
- }
-
- ++this.globalCount;
- }
-
- public void menumirrorSideWaysActionPerformed(ActionEvent var1) {
- asciiLibs var2 = new asciiLibs(this.artBuffer);
- var2.invert(this.countForOpenFile);
- this.refresh();
- }
-
- public void menuFileRefreshArtActionPerformed(ActionEvent var1) {
- this.bigString = "";
-
- for(this.field_0 = 0; this.field_0 < this.countForOpenFile; ++this.field_0) {
- this.bigString = this.bigString + this.artBuffer[this.field_0] + "\n";
- }
-
- this.fileBuffer.setText(this.bigString);
- }
-
- public void refresh() {
- this.bigString = "";
-
- for(this.field_0 = 0; this.field_0 < this.countForOpenFile; ++this.field_0) {
- this.bigString = this.bigString + this.artBuffer[this.field_0] + "\n";
- }
-
- this.fileBuffer.setText(this.bigString);
- }
-
- public void menumirrorFlipVerticleActionPerformed(ActionEvent var1) {
- asciiLibs var2 = new asciiLibs(this.artBuffer);
- var2.invertVert(this.countForOpenFile);
- this.refresh();
- }
-
- public void menuLineToolsVerticleLineActionPerformed(ActionEvent var1) {
- asciiLibs var2 = new asciiLibs(this.artBuffer);
- var2.horizontalLine(this.countForOpenFile);
- this.refresh();
- }
-
- public void menuFileReplaceCharactersActionPerformed(ActionEvent var1) {
- try {
- asciiLibs var2 = new asciiLibs(this.artBuffer);
- var2.replaceChar(this.countForOpenFileSave);
- this.refresh();
- } catch (IOException var3) {
- System.out.println("Bad stuff has occurred -1");
- }
-
- }
- }
-